package com.alibaba.bos.service.base.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.bos.dao.base.CourierRepository;
import com.alibaba.bos.domain.base.Courier;
import com.alibaba.bos.service.base.CourierService;
@Service
@Transactional
public class CourierServiceImpl implements CourierService{
    @Autowired
    private CourierRepository courierRepository;
    
    //添加快递员
    @Override
    public void save(Courier courier) {
            courierRepository.save(courier);
    }
    
    //分页查询
    @Override
    public Page<Courier> findPageData(Specification<Courier> specification,Pageable pageable) {
        return courierRepository.findAll(specification,pageable);
    }
    
    //批量操作
    @Override
    public void delBatch(String[] id) {
       //遍历获取id
        for (String c_id : id) {
            Integer i= Integer.parseInt(c_id);
            courierRepository.updateBatch(i);
        }
        
    }

}
